package jjn.round2;

import commons.ListNode;

/**
 * @author Jiang Jining
 * @since 2023-05-06 23:51
 */
public class Offer18_DeleteNode {
    public ListNode deleteNode(ListNode head, int val) {
        ListNode dummy = new ListNode(), start = dummy;
        dummy.next = head;
        while (start != null && start.next != null) {
            if (start.next.val == val) {
                start.next = start.next.next;
            }
            start = start.next;
        }
        return dummy.next;
    }
}
